package com.igeek.boot.entity;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DataSizeUnit;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.util.unit.DataSize;
import org.springframework.util.unit.DataUnit;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

/**
 * @package com.igeek.boot.entity
 * @Description 配置绑定
 * @Author LittlePunk [296526219@qq.ccom]
 * @Version 2022.1
 * @Date 2023/12/6 11:31
 */
@Data
@ConfigurationProperties(prefix = "my")
public class MyServer {
    private String ipAddr;
    private int port;
    //设置超时时间的单位
    @DurationUnit(ChronoUnit.MINUTES)
    private Duration timeout;
    //设置文件输出大小的单位
    @DataSizeUnit(DataUnit.GIGABYTES)
    private DataSize data;

}
